<template>
  <el-card class="order-container">
    <div class="data">
      <el-card class="data-item" shadow="hover">
        <template #header>
          <div class="card-header">
            <span>订单状态</span>
          </div>
        </template>
        <div>
          {{ data.orderStatusString }}
        </div>
      </el-card>
      <el-card class="data-item" shadow="hover">
        <template #header>
          <div class="card-header">
            <span>创建时间</span>
          </div>
        </template>
        <div>
          {{ data.createTime }}
        </div>
      </el-card>
      <el-card class="data-item" shadow="hover">
        <template #header>
          <div class="card-header">
            <span>订单号</span>
          </div>
        </template>
        <div>
          {{ data.orderNo }}
        </div>
      </el-card>
    </div>
    <el-table
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
    >
      <el-table-column
        label="商品图片"
      >
        <template #default="scope">
          <img style="width: 100px" :key="scope.row.goodsId" :src="prefix(scope.row.goodsCoverImg)" alt="商品主图">
        </template>
      </el-table-column>
      <el-table-column
        prop="goodsId"
        label="商品编号"
      >
      </el-table-column>
      <el-table-column
        prop="goodsName"
        label="商品名"
      ></el-table-column>
      <el-table-column
        prop="goodsCount"
        label="商品数量"
      >
      </el-table-column>
      <el-table-column
        prop="sellingPrice"
        label="价格"
      >
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import axios from '@/utils/axios'
import { prefix } from '../utils/proxy'

export default {
  name: 'OrderDetail',
  data () {
    return {
      prefix,
      data: {},
      tableData: []
    }
  },
  mounted () {
    const { id } = this.$route.query
    axios.get(`/orders/${id}`).then(res => {
      this.data = res
      this.tableData = res.mallOrderItemVOS
    
    })
  }
}
</script>

<style scoped>
.data {
  display: flex;
  margin-bottom: 50px;
}

.data .data-item {
  flex: 1;
  margin: 0 10px;
}

.el-table {
  border: 1px solid #EBEEF5;
  border-bottom: none;
}

.has-gutter th {
  border-right: 1px solid #EBEEF5;
}

.has-gutter th:last-child {
  border-right: none;
}

.el-table__row td {
  border-right: 1px solid #EBEEF5;
}

.el-table__row td:last-child {
  border-right: none;
}
</style>
